home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tppop16.zip / POPUP.DOC < prev    next >
Text File  |  1988-10-04  |  14KB  |  380 lines

  1.  
  2.                           T U R B O    P O P
  3.  
  4.              Memory Resident PopUp Routines Version 1.6
  5.                      for Turbo Pascal Version 4.0
  6.  
  7.                           Copyright (c)1988
  8.                        Ross Neilson Wentworth
  9.  
  10.                 Custom software at reasonable prices!
  11.  
  12.                   THIS PACKAGE IS NOT PUBLIC DOMAIN
  13.  
  14.                           All Rights Reserved
  15.  
  16.  
  17.                               DISCLAIMER
  18.  
  19.                     This software is provided without
  20.                      warranty, expressed or implied.
  21.  
  22.  
  23. The Turbo Pascal Units contained in this package will enable you to
  24. quickly and easily create popup programs.  Also included is a very simple
  25. windowing package.
  26.  
  27. All source code is included so that you may modify it to your hearts
  28. desire.  Do NOT release modified versions of this package under any
  29. circumstances.
  30.  
  31. Turbo Pascal Version 4.0 is required to use this package.  MASM 5.1
  32. is required to to re-assemble the low-level modules.
  33.  
  34. If you find this code useful, please send $10 to the address below or
  35. make a $10 donation to the "The Historic Oaks Foundation", located in
  36. Agoura Hills and Novato, California.  Let me know if you make the
  37. donation and you will receive full credit for registration (receipt or
  38. copy of cancelled check required).
  39.  
  40. If you use this code in any commerical program this payment is required.
  41. Shareware is considered commercial upon receipt of first registration.
  42.  
  43.                    Ross Neilson Wentworth
  44.                    Serendipity Software
  45.                    1422 Elkgrove Circle, #3
  46.                    Venice, CA  90291
  47.                    (213)399-1244
  48.  
  49.  
  50. Features of This Package
  51. ========================
  52.  
  53.   o Easily create memory resident popup programs (SideKick-like).
  54.   o Automatic program detection to prevent multiple loading. (new!)
  55.   o Allows TSR's with conflicting hot-keys   (new!)
  56.   o Simple program removal (new!)
  57.   o Uses proven TSR techniques.
  58.   o All DOS functions allowed from within resident program (except
  59.     I/O redirection), you can safely access the disk!
  60.   o No load-order limitations (except those imposed by other TSR's).
  61.   o Low code overhead, slightly over 1k EXE size increase to standard
  62.     application.
  63.  
  64. One of the problems with writing popup programs is DOS is not reentrant.
  65. That is, if you popup while DOS is busy you are very likely to crash the
  66. system.  This package does all the necessary checking and will only popup
  67. when it is safe.  This allows your program to do virtually anything including
  68. file access.  The one limitation is that it can not allocate additional memory.
  69. You can still use heap memory, just don't use the DOS function to allocate or
  70. modify a current memory block.
  71.  
  72. To guarantee a safe pop-up program it is necessary to grab hold of several
  73. interrupt vectors.  When the program is first initialized the following
  74. vectors are intercepted:
  75.  
  76.      09h      keyboard
  77.      13h      disk i/o
  78.      1Ch      timer
  79.      28h      backprocess
  80.      2Fh      multiplex
  81.  
  82. When the program is popped up, two additional vectors are also intercepted:
  83.  
  84.      23h      control-break
  85.      24h      critical error
  86.  
  87. In addition, a couple of other internal values are changed while the
  88. program is active:
  89.  
  90.      The Disk-Transfer-Area is saved and the popup's installed
  91.      The BREAK status is saved then turned off
  92.  
  93. These four items are restored when the TSR relinquishes control.
  94.  
  95. A sample program is provided that shows how to implement a popup program.
  96.  
  97. ===============================================================================
  98. Contents of POPUP:
  99.  
  100.   Function ReadKey : Char;
  101.  
  102.     Use this function instead of the one provided in the CRT unit.  Using
  103.     this routine will for keyboard entry will prevent other resident programs
  104.     from being "locked" out.  To guarantee that the correct READKEY is being
  105.     used, precede it with it's unit name, i.e., CH := POPUP.READKEY
  106.  
  107.   Function Installed(OurID : Byte) : Byte;
  108.  
  109.     Given a unique program ID number, this function returns zero (0) if
  110.     the program has not already been installed.  A nonzero value indicates
  111.     it has been installed or an error has occured:
  112.  
  113.        1 : PRINT.COM detected.  The TSR must be loaded before PRINT.COM.
  114.        2 : The program is already installed.
  115.        3 : Internal error, can't install.
  116.  
  117.     Error 3 is usually caused by a poorly designed TSR program that has
  118.     already been loaded into memory.  Try loading your program before any
  119.     others.  Experimenting with the order of loading should point out the
  120.     bad TSR.
  121.  
  122.   Procedure StayResident(OurID : Byte;ProgramAdress : Pointer;HotKey: Word);
  123.  
  124.     HOTKEY is your key combination that will activate your program.  It is of
  125.     type WORD where the low byte is the scan code and the high byte is the
  126.     shift status (ALT, CTRL, SHIFT, etc.  See below).  ProgramAddress is a
  127.     pointer to your popup procedure that you want called.  Precede the
  128.     program name with an '@' to pass a pointer.
  129.  
  130.          StayResident($69,@NotePad,Alt+LeftShift + $20);  (ALT-LeftShift-D);
  131.  
  132.     The shift status values are documented below.
  133.  
  134.     OurID is a unique number for your resident program.  Each different
  135.     TSR that you write should have a different ID number.  For maximum
  136.     compatibility, you should allow the user to change the ID number,
  137.     perhaps by using a 'command-line' option, i.e. /I=155.  MS-DOS reserves
  138.     ID numbers 0 to 80h for internal use.
  139.  
  140.   Procedure ReleaseBlock(Segment : Word);
  141.  
  142.     This inline macro releases the block of memory given a segment number.
  143.  
  144.   Procedure ReleaseEnvironment;
  145.  
  146.     Releases the block of memory holding the program's environment.  It keeps
  147.     track of whether it has already been called so that multiple calls will
  148.     not be harmful.
  149.  
  150. ===============================================================================
  151. Contents of UNHOOK:
  152.  
  153.   Function Installed(MultID : Byte) : Boolean;
  154.  
  155.     Returns TRUE if the resident program is in memory.
  156.  
  157.   Function OKToUnload(MultID : Byte) : Boolean;
  158.  
  159.     Returns TRUE if it is safe to unload the resident program from memory.
  160.  
  161.   Procedure RemoveProgram(MultID : Byte);
  162.  
  163.     Releases the memory and restores the interrupt vectors used by the
  164.     resident program.
  165.  
  166. ===============================================================================
  167. Contents of WINDOWS:
  168.  
  169.   Procedure MakeWindow(X1,Y1,X2,Y2,Foreground,Background : Word;Border : BorderType);
  170.  
  171.    This procedure saves the current screen memory and creates a bordered
  172.    window.  X1, Y1, X2, and Y2 are the same values used by Turbo's WINDOW
  173.    procedure.  Foreground and Background are the color attributes of the
  174.    border.  Border is the type of border desired.  Possible border types
  175.    are:
  176.  
  177.           NONE          -   no border
  178.           SINGLE        -   single line
  179.           DOUBLE        -   double line
  180.           DOUBLETOP     -   double top lines, single side lines
  181.           DOUBLESIDE    -   double side lines, single top lines
  182.           SOLID         -   solid block (space character)
  183.  
  184.     Example useage:
  185.  
  186.             MakeWindow(5,5,30,10,Black,White,Double);
  187.  
  188.   Procedure DrawBox(X1,Y1,X2,Y2,Forground,Background : Word;Border : BorderType);
  189.  
  190.     Works just like MakeWindow but doesn't save the underlying screen and
  191.     doesn't use a matching RemoveWindow.
  192.  
  193.   Procedure RemoveWindow;
  194.  
  195.     Removes the current top window, does nothing if there isn't any windows
  196.     defined with the MakeWindow procedure.
  197.  
  198.   Procedure SetCursor(Cursor : Word);
  199.  
  200.     Sets the cursor shape.  Some software packages turn off the cursor
  201.     so this is provided so you can set your prefered cursor shape.  The
  202.     windowing package saves the cursor shape of the underlying screen so
  203.     there is no need to restore it.
  204.  
  205.   Var VideoMode : Word;
  206.  
  207.     A DOS variable that holds the current video mode.  Use this to test
  208.     for and avoid popping in graphics modes.
  209.  
  210. ===============================================================================
  211. SAMPLE PROGRAMS
  212. =======